import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { MouldComponent } from './mould.compent';
import { MouldsComponent } from './moulds/moulds.component';
import { AddmouldsComponent } from './moulds/addmoulds/addmoulds.component';
import { EditMouldsComponent } from './moulds/edit-moulds/edit-moulds.component';
import { CanActivateGuard } from 'src/app/@core/services/can-load-service.guard';

const routes: Routes = [
  {
    path: '',
    component: MouldComponent,
    children: [
      {
        path: 'moulds',
        component: MouldsComponent,
        canActivate: [CanActivateGuard],
      },
      {
        path: 'add-mould',
        component: AddmouldsComponent,
        canActivate: [CanActivateGuard],
      },
      {
        path: 'edit-mould',
        component: EditMouldsComponent,
        canActivate: [CanActivateGuard],
      },
      {
        path: '',
        redirectTo: 'moulds',
        pathMatch: 'full',
      },
    ],
  },
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class MouldRoutingModule {}
